﻿using ReflectionStudio.Core.Events;
using System;
using System.ComponentModel;
using System.Data;
using System.Windows;
using System.Linq;
using WPFExcelReport.Helpers;
using System.Windows.Input;
using System.Windows.Controls;
namespace WPFExcelReport
{
    /// <summary>
    /// 专用于布卷剪布
    /// 搜索大布卷，列出所有小布卷，填入重量，确定，转移到指定库位和托盘
    /// </summary>
    public partial class TRWGWB08
    {

        public TRWGWB08()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            MV = new VWBBST();
            this.DataContext = MV;
            InitializeComponent(); 
        }
        public override void vwMaster_CurrentChanged(object sender, EventArgs e)
        {
            base.vwMaster_CurrentChanged(sender, e); 
        }
        public override void Query_KeyUp(object sender, KeyEventArgs e)
        {
            base.Query_KeyUp(sender, e);
        }
        public override void QueryCommand(object sender, RoutedEventArgs e)
        {
            TBMain.Clear();
            if (STKNR.Length < 12)
                return;
            dwData = TBMain.NewRow();
            dwData["WBBMANDANT"] = app.Mandant;
            dwData["WBBSTKNR"] = STKNR;
            SResult = TMV.QWB13(dwData);
            MergeData(SResult, true);
            //base.QueryCommand(sender, e);
        } 
        public override void OnCKGChg()
        {  
            if (dwMaster == null)
                return;
            if(CKG==0)
            {
              
                TMV.UpdateWBBST(dwMaster, 0); 
                IsPrint = true;
                return;
            } 
            TMV.WBBSGEW = CKG; 
            base.OnCKGChg();
        } 
        private void PrintLBCommand(object sender, RoutedEventArgs e)
        {
            IsPrint = false;
            IsPrint = true;
        }

    }
}
